package com.hdaccp.foodsales.controller;


import com.hdaccp.foodsales.dao.XingqiDao;
import com.hdaccp.foodsales.pojo.xingqiBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/xq")
@Scope("prototype")
public class xingqiController {
    @Autowired
    private XingqiDao xingqiDao;
    @RequestMapping("/queryXingqi")
    @ResponseBody
    public Map<String,List<Object>>queryXingqi(){
        Map<String,List<Object>>map=new HashMap<>();
        List<xingqiBean>list=xingqiDao.query();
        List<Object>list1=new ArrayList<>();
        List<Object>list2=new ArrayList<>();

        for(xingqiBean bean:list){
            list1.add(bean.getRiqi());
            list2.add(bean.getSpshu());
        }

        map.put("xinqi",list1);
        map.put("xineqi",list2);



        return map;
    }
}
